package com.walker.config;

import com.walker.condition.LinuxCondition;
import com.walker.condition.WindowCondition;
import com.walker.entity.Person;
import com.walker.service.PersonService;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.*;

/**
 * @Description:
 * @ProjectName: walker-step
 * @Package: com.walker.config
 * @ClassName: MainConfig
 * @Author: yangyl
 * @CreateDate: 2020/6/9 23:33
 */
@Configuration
@ComponentScan(basePackages = {"com.walker"})
//@Import({PersonService.class})
@Import({})
public class MainConfig {

    //作用域
    //@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    @Bean
    @Lazy
    public Person person01(){
        System.out.println("person.......");
        return new Person("SU001","诸葛流云");
    }

    @Conditional({WindowCondition.class})
    @Bean
    public Person windowPerson(){
        return new Person("window","window");
    }

    @Conditional({LinuxCondition.class})
    @Bean
    public Person linuxPerson(){
        return new Person("linux","linux");
    }


}
